#ifndef __ELF_H__
#define __ELF_H__

#define EI_NIDENT 16
#define PT_LOAD 1

typedef unsigned int Elf32_Addr;         // Unsigned program address
typedef unsigned int Elf32_Off;          // Unsigned file offset
typedef unsigned short Elf32_Half;         // Unsigned medium integer
typedef unsigned int Elf32_Word;         // Unsigned integer
typedef int Elf32_Sword;        // Signed integer
struct elf_header
{
	unsigned char ident[EI_NIDENT];
	Elf32_Half type;
	Elf32_Half machine;
	Elf32_Word version;
	Elf32_Addr entry;
	Elf32_Off phoff;
	Elf32_Off shoff;
	Elf32_Word flags;
	Elf32_Half ehsize;
	Elf32_Half phentsize;
	Elf32_Half phnum;
	Elf32_Half shentsize;
	Elf32_Half shnum;
	Elf32_Half shstrndx;
} __attribute__((packed));
typedef struct elf_header elf_header_t;

struct elf_program_header
{
	Elf32_Word type;
	Elf32_Off offset;
	Elf32_Addr vaddr;
	Elf32_Addr paddr;
	Elf32_Word fileSize;
	Elf32_Word memSize;
	Elf32_Word flags;
	Elf32_Word align;
} __attribute__((packed));
typedef struct elf_program_header elf_program_header_t;

int openModule_elf(char* name, int offset);

#endif